export class User {
  constructor({unique, name, face}) {
    this.unique = unique
    this.name = name
    this.face = face
  }
}

export class iUser{
  getUserInfo(){
    return {
        face: '58b3d7f8cd186.jpg',
        name: '一颗大树一只猫',
        unique: '58b3d7f8cd186'
    };
  }
}

export class message{
    constructor({unique, name, face, content, type}) {
        this.unique = unique;
        this.name = name;
        this.face = face;
        this.content = content;
        this.type = type;
        this.time = this.getDataTime();
        this.success = false;
    }

    sendMessage({accept,send,content}){
        return {
            accept: accept,
            send: send,
            content: content
        };
    }

    getDataTime(){
        var date = new Date();
        var seperator1 = "-";
        var seperator2 = ":";
        var month = date.getMonth() + 1;
        var strDate = date.getDate();
        var seconds = date.getSeconds();
        if (month >= 1 && month <= 9) {
            month = "0" + month;
        }
        if (strDate >= 0 && strDate <= 9) {
            strDate = "0" + strDate;
        }
        if (seconds >= 0 && seconds <= 9) {
            seconds = "0" + seconds;
        }
        return date.getFullYear() + seperator1 + month + seperator1 + strDate
                + " " + date.getHours() + seperator2 + date.getMinutes()
                + seperator2 + seconds;
    }
}